package com.dotto.atos.models;

import java.util.HashMap;

import org.json.JSONObject;

public class City {
	private int id;
	private int plate;
	private String name;
	private String region;
	private HashMap<String, Branch> provinces;

	public City() {

	}

	public City(JSONObject obj) {
		if (obj != null) {
			this.id = obj.optInt("plaka");
			this.region = obj.optString("bolge");
			this.name = obj.optString("il");
		}
	}

	public void putProvince(Branch pro) {
		if (pro != null && pro.getId() > 0) {
			if (provinces == null)
				provinces = new HashMap<String, Branch>();
			pro.setCity(this);
			provinces.put(pro.getId() + "", pro);
		}
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getPlate() {
		return plate;
	}

	public void setPlate(int plate) {
		this.plate = plate;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getRegion() {
		return region;
	}

	public void setRegion(String region) {
		this.region = region;
	}

	public HashMap<String, Branch> getProvinces() {
		return provinces;
	}

	public void setProvinces(HashMap<String, Branch> provinces) {
		this.provinces = provinces;
	}

}
